Add Experiment Lifecycle Orchestrator (first long-horizon loop)#7
Merged
Conversation
The flagship long-horizon loop, built on the longrun primitives (durable state + approval gates + resumable runPlan): - loops/experiment/: a resumable plan design -> approve-design (gate) -> launch -> bake (wait) -> readout -> decide (gate), advanced by advanceExperiment() which resumes from the last pause and no-ops once complete. Injected boundaries: AI designer + ExperimentPlatform. A rejected design short-circuits without launching; ship/kill is always human-gated. - src/ai: createExperimentDesigner adapter. - Full-lifecycle tests (design gate, bake wait, decision gate, completion, rejection) with fakes + memory store. Shipped via the OpenSpec cycle (openspec/specs/experiment-orchestrator.md). Validated: typecheck, lint, 111 tests, clean build. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012CrMioorha3QtPUgWbtDbR
DCCA
commented
Jun 22, 2026
DCCA
left a comment
Owner
Author
There was a problem hiding this comment.
Code review
CI green (build success, ~31s); locally typecheck, lint, 111 tests, and build pass.
Strengths
- Proves the primitives end-to-end. The plan composes
runPlan+Gate+StateStoreexactly as designed:doneadvances, gates emitblocked, the bake emitswaiting, and progress persists so eachadvanceExperimentresumes from the last pause. Tests drive the full path (design gate → bake wait → decision gate → completion) and the rejection short-circuit across separate calls sharing one store. - Safe by construction. No auto-ship — both design and ship/kill are human gates; bake completes only when the platform reports results (not on a timer), avoiding action on early/noisy data; a rejected design never launches.
- Idempotent steps. Re-running a step is safe (gate
requireis idempotent; launch/bake key off persisted memory), which is exactly what the resumption contract requires. - Clean boundaries. Designer (AI) and ExperimentPlatform are injected; the AI adapter mirrors the existing provider pattern.
Notes (non-blocking, already scoped as follow-ups)
- Programmatic only — no
loopy advance <plan>CLI verb yet, and the readout/decision aren't emitted to an external system (issue tracker/dashboard). Both are noted follow-ups. - The bake's
untilIsois informational; the real gate is platform result availability — correctly documented.
Recommend merge.
Generated by Claude Code
DCCA
pushed a commit
that referenced
this pull request
Jun 23, 2026
Rank #7 from research deep-dive #3. A long-horizon loop on runPlan + Gate + StateStore that migrates to a new model version safely: - loops/model-upgrade-migration/: advanceModelUpgrade() runs a resumable plan baseline -> candidate -> diff -> approve (gate) -> apply. It evaluates a golden set on the current and candidate models (injected evaluate(modelId)), computes regressions + score delta (reusing prompt-eval's Scorecard/ regressions), blocks at a human approval gate, and on approval emits the model-id bump change set (result.bump); on rejection it holds. Programmatic like the experiment orchestrator (a PR adapter/CLI verb is a shared follow-up). Shipped via the OpenSpec cycle (openspec/specs/model-upgrade-migration.md). Validated: typecheck, lint, 174 tests (+2), clean build. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012CrMioorha3QtPUgWbtDbR
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the Experiment Lifecycle Orchestrator — the first long-horizon loop, built on the
longrunprimitives (durable state + approval gates + resumablerunPlan). It proves the long-horizon model end-to-end.The plan
advanceExperiment(planId, hypothesis, services, store)runs/resumes the plan; call it repeatedly (e.g. on a schedule). It blocks at human gates, waits during the bake, persists progress, and is a no-op once complete.createExperimentDesignerover the OpenRouter provider) and an ExperimentPlatform (launch+results) — adapt to Statsig/Eppo/GrowthBook/LaunchDarkly.Changes
loops/experiment/— types, plan/steps,advanceExperiment, readout, README, playbooksrc/ai/providers.ts—createExperimentDesignertest/loops/experiment.test.ts— full lifecycle (design gate → bake wait → decision gate → completion) + rejection short-circuit, via fakes + memory storeOpenSpec
Shipped via proposal → apply → archive; source of truth:
openspec/specs/experiment-orchestrator.md.Validation
npm test— 111 tests (+3)npm run build— clean (dist/loops/experiment)Note: programmatic for now — a
loopy advance <plan>CLI verb (and non-PR output adapters for the readout/decision) are planned follow-ups.🤖 Generated with Claude Code
https://claude.ai/code/session_012CrMioorha3QtPUgWbtDbR
Generated by Claude Code